/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.basis.fehler;

import de.mnit.basis.sys.Ausgabe;


/**
 * @author Michael Nitsche
 * 17.04.2009	Erstellt
 */
public class Warnung {

	public static <T extends Comparable<? super T>> void wennUeber(T max, T wert) {
		wennAusserhalb(null, max, wert);
	}

	public static <T extends Comparable<? super T>> void wennUnter(T min, T wert) {
		wennAusserhalb(min, null, wert);
	}

	public static <T extends Comparable<? super T>> void wennAusserhalb(T min, T max, T wert) {
		if(min!=null && wert.compareTo(min)<0)
			Ausgabe.warnung("Wert ist unterhalb des Limits! ("+wert+" < "+min+")");
		if(max!=null && wert.compareTo(max)>0)
			Ausgabe.warnung("Wert ist über dem Limit! ("+wert+" > "+max+")");
	}

}
